package com.mc.jf.apicontroller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mc.jf.entity.*;
import com.mc.jf.service.impl.FhplanServiceImpl;
import com.mc.jf.service.impl.PlanServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Lin
 * @since 2022-08-19
 */
@RestController
@RequestMapping("/api/fhplan")
public class FhPlanApiController {

    @Autowired
    FhplanServiceImpl fhplanService;




    @GetMapping(value = "/all")
    public HttpListResponse all() {

        List<Fhplan> list=fhplanService.list();
        for (Fhplan fhplan:list){
            if (StringUtils.hasText(fhplan.getContact())){
                fhplan.setDesc("已预约");
            }else {
                fhplan.setDesc("");
            }
        }
        return ResUtil.list((long) list.size(),list);
    }

}
